package com.example.miaosha.mapper;

import com.example.miaosha.entity.UserInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;


/**
 * @Date : 2020/09/13 16:14
 * @Author : lerry_li
 */

@Mapper
public interface UserInfoMapper {

    //通过id获取用户信息
    @Select("SELECT * FROM user_info WHERE id = #{id}")
    UserInfo selectByPrimaryId(Integer id);

    //插入一条数据
    @Insert("INSERT INTO user_info (name,gender,age,phone,register_mode) " +
            "VALUES (#{name},#{gender},#{age},#{phone},#{registerMode})")
    void insertSelective(UserInfo record);

    //通过手机号获取用户信息
    @Select("SELECT * FROM user_info WHERE phone = #{phone}")
    UserInfo selectByPhone(String phone);
}
